from random  import choice
numbers=(1,2,3,4,5,6,7,8,9,0)
number_1=choice(numbers)
number_2=choice(numbers)
number_3=choice(numbers)
number_4=choice(numbers)
print("These four numbers on the lottery ticket win the grand prize")
print(f"They are :{number_1},{number_2},{number_3},{number_4}")

wining_information=[number_1,number_2,number_3,number_4]
my_tickets=[]
#设置计数变量
count=0
#设置循环因子
active=1
while active:
    my_tickets.append(choice(numbers))
    if len(my_tickets)==4:
        if my_tickets==wining_information:
            print(f"You finally win the lottery after {count} failures!")
            break
        else:
            count+=1
            my_tickets.clear()#清空列表所有元素


